home *** CD-ROM | disk | FTP | other *** search
/ The Fatted Calf / The Fatted Calf.iso / Demos / ByCompany / iXpoint / QMSprint / QMSprint.app / qfilter.suffix < prev    next >
Text File  |  1994-03-20  |  2KB  |  129 lines

  1.  
  2. # Copyright (C) 1992 QMS, Inc
  3.  
  4. #
  5. # Test LOG for writability
  6. #
  7.  
  8. if [ ! -w $LOG ]
  9. then
  10.     echo "Can't open log file $LOG for writing." | mail root $USER
  11.     rm -f $PROLOGUE
  12.     exit 2
  13. fi
  14.  
  15. #
  16. # Begin the log entry
  17. #
  18.  
  19. echo `date` >> $LOG
  20. echo "qfilter: Initiating Send of File" >> $LOG
  21.  
  22. touch $PROLOGUE
  23. if [ $DOC_SUPPORTED = yes ]
  24. then
  25. #
  26. # Create the DCL prologue file
  27. #
  28.  
  29. echo "%!" >> $PROLOGUE
  30. echo "%%For: $USER" >> $PROLOGUE
  31. echo "%%Date: $DATE" >> $PROLOGUE
  32. fi
  33.  
  34.  
  35. #
  36. # Check for a preprologue file in the spool directory.  Append it
  37. # to the PROLOGUE file if it exists.
  38. #
  39.  
  40. if test -r $PREPROLOGUE
  41. then
  42.     cat $PREPROLOGUE >> $PROLOGUE
  43. fi
  44.  
  45. #
  46. # Check for a setup file in the spool directory.  Append it
  47. # to the PROLOGUE file if it exists.
  48. #
  49.  
  50. if test -r $SETUPFILE
  51. then
  52.     cat $SETUPFILE >> $PROLOGUE
  53. fi
  54.  
  55. #
  56. # Log the fact that we are about to begin file transfer
  57. #
  58.  
  59. echo `date` >> $LOG
  60. echo "qfilter: Beginning File Transfer" >> $LOG
  61.  
  62. #
  63. # Recover the stdin file descriptor
  64. #
  65.  
  66. exec 0<&5
  67.  
  68. #
  69. # Send the data (via the chosen protocol) to the printer
  70. #
  71.  
  72. if [ $COMM_OPTION != tcp/ip ]
  73. then
  74.  
  75.     #
  76.     # Communications option is serial or parallel, so all we have
  77.     # to do is put the data onto stdout.  Then sleep until the comm
  78.     # timeout on the printer is reached, so no other jobs can be
  79.     # concatenated onto this one
  80.     #
  81.  
  82.     ( cat $CATQEF - ) 2>> $LOG | $FILQEF
  83.     if [ $COMM_OPTION = parallel ]
  84.     then
  85.         echo -n "0statusdict begin 1 200 setemulation end"
  86.     else
  87.         echo -n "0statusdict begin 0 200 setemulation end"
  88.     fi
  89.     sleep $EM_TIMEOUT
  90.  
  91. else
  92.  
  93.     #
  94.     # Communication Protocol is Ethernet
  95.     # Send file to printer via the QMS Ethernet Filter
  96.     #
  97.  
  98. #   Modified by iXpoint 1994
  99.     ( cat - | $FILTER -f -P $PRINTERNAME ) 2>>$LOG | $PARSER | cat $CATQEF - | ( $QEF $PARAMETERS ) 1>> $LOG 2>&1
  100.     STATUS=$?
  101.  
  102.  
  103.     #
  104.     # Check for problems with the above transaction and tell the spooler
  105.     # there was a problem if one was found.
  106.     #
  107.  
  108.     if [ $STATUS != 0 ]
  109.     then
  110.     rm $PROLOGUE
  111.     echo "qfilter: Filter $QEF Could Not Complete Data Transfer" >> $LOG
  112.     echo
  113.     exit 2
  114.     fi
  115.  
  116. fi
  117.  
  118. #
  119. # Clean up the temp files, log that we've finished, and exit happily
  120. #
  121.  
  122. echo `date` >> $LOG
  123. echo "qfilter: File Transfer Complete" >> $LOG
  124. echo >> $LOG
  125. rm $PROLOGUE
  126.  
  127. exit 0
  128.  
  129.